package UF_SOCK;

public class Example {
    private Socket s;

    private void message(final Socket s, final String message) {
        try {
            s.getOutputStream().write(message.getBytes());
        } catch (IOException e) {
            try {
                s.close();
            } catch (IOException e1) {
                //ignore
            }
        }
    }

    public void handshake() {
        message(s, "hello");
    }

    public void requestData(final String key) throws IOException {
        handshake();
        message(s, "get_data[" + key + ']');
    }
}
